package com.ylfstu.Homework;

public class Homework04 {
    public static void main(String[] args) {
        Worker worker = new Worker("jack", 200, 24, 1);
        worker.printSalary();
        Manager manager = new Manager("Joy", 26, 1000, 1.3);
        manager.setBonus(1200);
        manager.printSalary();
    }
}
class Employee{
    private String name;
    private double daySalary;
    private int workdays;
    private double grade;

    public Employee(String name, double daySalary, int workdays, double grade) {
        this.name = name;
        this.daySalary = daySalary;
        this.workdays = workdays;
        this.grade = grade;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getDaySalary() {
        return daySalary;
    }

    public void setDaySalary(double daySalary) {
        this.daySalary = daySalary;
    }

    public int getWorkdays() {
        return workdays;
    }

    public void setWorkdays(int workdays) {
        this.workdays = workdays;
    }

    public void printSalary(){
        System.out.println(name + " salary = " + (daySalary * workdays * grade));
    }
}
class Manager extends Employee{
    private double bonus;

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }

    public Manager(String name, double daySalary, int workdays, double grade) {
        super(name, daySalary, workdays, grade);
    }

    @Override
    public void printSalary() {
        System.out.println("经理 " + super.getName()+ " salary = "
                + (super.getDaySalary() * super.getWorkdays() * getGrade() + bonus));
    }
}
class Worker extends Employee{
    public Worker(String name, double daySalary, int workdays, double grade) {
        super(name, daySalary, workdays, grade);
    }

    @Override
    public void printSalary() {
        System.out.println("员工 " + super.getName() + " salary = "
                + (super.getDaySalary() * super.getWorkdays() * getGrade()));
    }
}